/*
 * @Author: qiuz
 * @Github: <https://github.com/qiuziz>
 * @Date:  2020-12-10 23:36:40
 * @Last Modified by: qiuz
 */

import { View } from "@tarojs/components";
import React from "react";
import "./index.scss";
import { isArray } from "@utils";



const BoxShadow = props => {
  const {
    shadowColor = "#000",
    shadowOffset = { width: 0, height: 0 },
    shadowOpacity = 1,
    shadowRadius = 0,
    elevation = 1,
    boxShadow = "",
    style = {},
    className = "",
    ...rest
  } = props;
  let customeStyle = IS_RN
    ? {
        shadowColor,
        shadowOffset,
        shadowOpacity,
        shadowRadius,
        elevation
      }
    : {
        boxShadow
      };
  const propsStyle = Object.assign(
    customeStyle,
    ...(isArray(style) ? style : [style])
  );
  return !IS_WEAPP ? (
    <View
      className={`box-shadow__content ${className}`}
      style={propsStyle}
      {...rest}
    >
      {props.children}
    </View>
  ) : (
    <View className={`box-shadow__content ${className}`} style={propsStyle}>
      {props.children}
    </View>
  );
};

export default BoxShadow;
